<template>
	<view>
		<input type="text" v-model="name"/>
		<input type="text" v-model="password"/>
		<button @click="Reg">注册</button>
	</view>
</template>

<script setup>
	import {ref} from 'vue'
	let name = ref("")
	let password = ref('')
	const Reg=()=>{
	    uni.request({
	        url: 'http://47.94.6.186:3001/api/user/reg',
	        method: 'POST', 
	        data: {
	            loginname: name.value,
				password:password.value,
	        },
	        success: (res) => {
	            console.log(res.data);
				if(res.data.code == 200){
					setTimeout(() => {
					      uni.navigateTo({
					          url: "/pages/login/login"
					      })      
					     }, 1000);
				}
				
	        },
	        fail: () => {
	
	        },
	        complete: () => {
	        }
	    });
	}
	
</script>

<style>

</style>
